#[derive(Debug)]
struct Point {
    x: f32,
    y: f32,
}

#[derive(Debug)]
struct Rectangle {
    #[allow(dead_code)]
    point: Point,
    width: f32,
    height: f32,
}

impl Rectangle {
    fn rect_area(&self) -> f32 {
        let Rectangle { point: _, width, height } = self;
        width * height
    }

    fn square(&self, point: Point, len: f32) -> Rectangle {
        Rectangle {
          point: point,
          width: len,
          height: len,
        }
    }
}

pub fn practice() {
    let point: Point = Point { x: 0.3, y: 0.4 };
    println!("point coordinates: ({}, {})", point.x, point.y);
    
    let new_point = Point { x: 0.1, ..point };
    println!("second point: ({}, {})", new_point.x, new_point.y);
    
    let Point { x: my_x, y: my_y } = point;
    let rectangle = Rectangle {
        point: Point { x: my_y, y: my_x },
        width: 1.3,
        height: 1.4,
    };
    println!("area: {}", rectangle.rect_area());
    println!("square: {:?}", rectangle.square(point, 1.2));
}